<?php

function inStock($partNo, $con) {
	$query = "SELECT * FROM item INNER JOIN stock ON item.part_no=stock.itemID WHERE item.part_no=" . $partNo . " AND stock.quantity>0";
	if ($result = mysqli_query($con, $query)) {
		if (mysqli_num_rows($result) > 0) {
			return true;
		} else {
			return false;
		}
	} else {
		echo "There was an error: " . mysqli_error($con) . "<br>";
	}
}

?>